import Arbori.*;
import Functii.*;
import Operatori.*;

public class Main {
	
	public static void main(String args[]){
		
		//exemplu cu Plus: f(x)=x+2  
		Nod n=new Necunoscuta();
		Nod c=new Constanta(2);		
		Nod plus=new Plus();
		
		plus.setFStang(n);
		plus.setFDrept(c);
		
		ArboreFunctional a=new ArboreFunctional(plus);
		
		System.out.println("Functia este: f(x)="+a);
		System.out.println("Derivata este: f'(x)="+a.derivata());
		System.out.println("f(3)="+a.calculezValoare(3));
		System.out.println("f'(3)="+a.calculezDerivata(3));
		System.out.println();
		
		
		
		
		
		//exemplu cu StelutaSteluta : f(x)=sqrt(x) ** sh(x) + x^2
		Nod n10=new Necunoscuta();
		Nod rad= new Radical();
		rad.setFStang(n10);
		
		Nod n11= new Necunoscuta();
		Nod sinh = new SinHiperbolic();
		sinh.setFStang(n11);
		
		Nod plus2=new Plus();
		plus2.setFStang(rad);
		plus2.setFDrept(sinh);
		
		Nod minus=new Minus();
		Nod c10=new Constanta(2);	
		minus.setFStang(plus2);
		minus.setFDrept(c10);
		
		Nod n12= new Necunoscuta();
		Nod putere= new Putere();
		putere.setFStang(n12);
		
		Nod plus3=new Plus();
		plus3.setFStang(minus);
		plus3.setFDrept(putere);
		
		ArboreFunctional a10=new ArboreFunctional(plus3);
		
		System.out.println("Functia este: f(x)="+a10);
		System.out.println("Derivata este: f'(x)="+a10.derivata());
		System.out.println("f(3)="+a10.calculezValoare(3));
		System.out.println("f'(3)="+a10.calculezDerivata(3));
		System.out.println();
		
		
		

		
		
		//
		//exemplu cu Produs: f(x)=2*x 
		Nod n2=new Necunoscuta();
		Nod c2=new Constanta(2);
		
		Nod produs2=new Produs();
		produs2.setFStang(c2);
		produs2.setFDrept(n2);
		
		ArboreFunctional a2=new ArboreFunctional(produs2);
		
		System.out.println("Functia este: f(x)="+a2);
		System.out.println("Derivata este: f'(x)="+a2.derivata());
		System.out.println("f(3)="+a2.calculezValoare(3));
		System.out.println("f'(3)="+a2.calculezDerivata(3));
		System.out.println();
		
		
		//
		//exemplu cu Cat: f(x)=x/2
		Nod n3=new Necunoscuta();
		Nod c3=new Constanta(2);
		
		Nod cat=new Cat();
		cat.setFStang(c3);
		cat.setFDrept(n3);

		
		ArboreFunctional a3=new ArboreFunctional(cat);
		
		System.out.println("Functia este: f(x)="+a3);
		System.out.println("Derivata este: f'(x)="+a3.derivata());
		System.out.println("f(3)="+a3.calculezValoare(3));
		System.out.println("f'(3)="+a3.calculezDerivata(3));
		System.out.println();
		
		
		
		//
		//
		//exemplu cu sin : f(x)=sin(x) + 2*x
		Nod n4=new Necunoscuta();
		Nod sin=new Sin();
		sin.setFStang(n4);
		
		Nod n5 = new Necunoscuta();
		Nod c4 = new Constanta(2);
		Nod prod =new Produs();
		prod.setFStang(c4);
		prod.setFDrept(n4);
		
		Nod sum=new Plus();
		sum.setFStang(sin);
		sum.setFDrept(prod);
		
		ArboreFunctional a4=new ArboreFunctional(sum);
		
		System.out.println("Functia este: f(x)="+a4);
		System.out.println("Derivata este: f'(x)="+a4.derivata());
		System.out.println("f(3)="+a4.calculezValoare(3));
		System.out.println("f'(3)="+a4.calculezDerivata(3));
		System.out.println();
		
		
		//
		//exemplu cu Cos: f(x)=cos(x)
		Nod n7=new Necunoscuta();
		Nod cos=new Cos();
		cos.setFStang(n7);
		
		ArboreFunctional a7=new ArboreFunctional(cos);
		
		System.out.println("Functia este: f(x)="+a7);
		System.out.println("Derivata este: f'(x)="+a7.derivata());
		System.out.println("f(3)="+a7.calculezValoare(3));
		System.out.println("f'(3)="+a7.calculezDerivata(3));
		System.out.println();
		
		
		//
		//
		//exemplu cu tg: f(x)=tg(x)+2x
		Nod n8=new Necunoscuta();
		Nod tg=new Tangenta();
		tg.setFStang(n8);
		
		Nod n9 = new Necunoscuta();
		Nod c9 = new Constanta(2);
		Nod prod9 =new Produs();
		prod9.setFStang(c9);
		prod9.setFDrept(n9);
		
		Nod sum9=new Plus();
		sum9.setFStang(tg);
		sum9.setFDrept(prod9);
		
		ArboreFunctional a8=new ArboreFunctional(sum9);
		
		System.out.println("Functia este: f(x)="+a8);
		System.out.println("Derivata este: f'(x)="+a8.derivata());
		System.out.println("f(3)="+a8.calculezValoare(3));
		System.out.println("f'(3)="+a8.calculezDerivata(3));
		System.out.println();
		
		
//		
		
	
		
		
		
	}

}
